import Source from '../../Entity/Source';
import { MainSearchTableProps } from '../../MainSearchTable/interface';

/**
 * @desc 用来生成基础资源单独选择的表格接口请求.
 * @param coursewareGroup '课件类型,详细见课件类型枚举分类',如果不填写,默认就没有
 */
function BaseSourceGet(coursewareGroup?: string) {
  return function (...params: Parameters<NonNullable<MainSearchTableProps['tableRequest']>>) {
    return Source.getBaseSource(params[0], params[1], {
      coursewareGroup: coursewareGroup,
      ...params[2],
    });
  };
}
/**
 * @desc 用来生成已上架的基础资源单独选择的表格接口请求.
 * @param type type="课件包"||"试卷"
 */
function ReadySourceGet(type?: string, alreadyParams?: any) {
  return function (...params: Parameters<NonNullable<MainSearchTableProps['tableRequest']>>) {
    return Source.getBaseReadySource(params[0], params[1], {
      type: type,
      ...params[2],
      ...alreadyParams,
      name: params[2]?.resourceName,
    });
  };
}

/**
 * @description 获取平台发布的课件包
 *
 */
function GetPlatformPkg(alreadyParams?: {}) {
  return function (...args: Parameters<NonNullable<MainSearchTableProps['tableRequest']>>) {
    return Source.getPlatformPkg(args[0], args[1], {
      ...args[2],
      ...alreadyParams,
    });
  };
}

/**
 * @description 获取平台发布的试卷
 *
 */
function GetPlatformPaper(alreadyParams?: {}) {
  return function (...args: Parameters<NonNullable<MainSearchTableProps['tableRequest']>>) {
    return Source.getPlatformPaper(args[0], args[1], {
      ...args[2],
      ...alreadyParams,
    });
  };
}

/**
 * @description 获取企业协会自建课件包
 *
 */
function GetGovernmentPkg(alreadyParams?: {}) {
  return function (...args: Parameters<NonNullable<MainSearchTableProps['tableRequest']>>) {
    return Source.getGovernmentPkg(args[0], args[1], {
      ...args[2],
      ...alreadyParams,
    });
  };
}

/**
 * @desc 获取企业协会自建的资源 coursewareGroup: 700(视频课件) 800：图文，900：pdf，600(试卷)
 */
function GetGovernmentSource(alreadyParams?: {}) {
  return function (...args: Parameters<NonNullable<MainSearchTableProps['tableRequest']>>) {
    return Source.getGovernmentSource(args[0], args[1], {
      ...args[2],
      ...alreadyParams,
    });
  };
}

export { BaseSourceGet, ReadySourceGet, GetPlatformPkg, GetPlatformPaper, GetGovernmentPkg, GetGovernmentSource };
